<template>
  <div ref="radar" class="radar" />
</template>

<script>
// 引入雷达图 核心模块
import * as echarts from 'echarts/core'
// 引入雷达图表
import { RadarChart } from 'echarts/charts'
// 引入组件
import {
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  TransformComponent,
  LegendComponent
} from 'echarts/components'
// 标签自动布局，全局过渡动画等特性
import { LabelLayout, UniversalTransition } from 'echarts/features'
// 引入 Canvas 渲染器，注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
import { CanvasRenderer } from 'echarts/renderers'
// 注册必须的组件
echarts.use([
  TitleComponent,
  TooltipComponent,
  GridComponent,
  DatasetComponent,
  TransformComponent,
  LabelLayout,
  UniversalTransition,
  CanvasRenderer,
  LegendComponent,
  RadarChart
])
export default {
  name: 'Radar',
  mounted() {
    const myChart = echarts.init(this.$refs.radar)
    myChart.setOption({
      title: {
        text: '员工绩效表'
      },
      legend: {
        data: ['小张', '小王']
      },
      radar: {
        // shape: 'circle',
        indicator: [
          { name: '反映能力', max: 100 },
          { name: '理解能力', max: 100 },
          { name: '排错能力', max: 100 },
          { name: '沟通能力', max: 100 },
          { name: '动手能力', max: 100 },
          { name: '协调能力', max: 100 }
        ],
        center: ['40%', '50%']

      },
      series: [
        {
          name: 'Budget vs spending',
          type: 'radar',
          data: [
            {
              value: [50, 50, 50, 50, 50, 0],
              name: '小张'
            },
            {
              value: [100, 100, 100, 100, 100, 100],
              name: '小王'
            }
          ]
        }
      ]
    })
  }

}
</script>

<style scoped>
.radar {
    width: 600px;
    height: 400px;
    border: 1px solid red;
}
</style>
